package gui.views;


import core.Model;
import gui.Frame;

import javax.swing.*;
import java.awt.*;


public class LoggingView extends JPanel {
    
    private static final long serialVersionUID = 1L;
    
    private static GraphView graphPanel;
    private static OptionsView optionsPanel;
    private static MapsView mapsView;

    public LoggingView() {
        JPanel left = new JPanel();
        graphPanel = new GraphView();
        mapsView = new MapsView();
        //mapsView.setPreferredSize(new Dimension(800, 800));
        left.setLayout(new FlowLayout());
        left.setPreferredSize(new Dimension((int)(Frame.WIDTH * Frame.WEIGHT),Frame.HEIGHT));
        left.add(graphPanel);
        left.add(mapsView);

        //LoggingView.connectAction = connectAction;
        
        optionsPanel = new OptionsView(mapsView); //For now, optionsView controls mapsView. Probably shouldn't be.
        optionsPanel.setLayout(new GridLayout(Model.getVariableIds().keySet().size(), 1));

        JScrollPane scrollable = new JScrollPane(optionsPanel);
        scrollable.setPreferredSize(new Dimension((int)(Frame.WIDTH * (1-Frame.WEIGHT)),Frame.HEIGHT));

        add(left);
        add(scrollable);
        setVisible(true);
    }

	public void update() {
		graphPanel.update();
		optionsPanel.update();
	}
}
